<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header style="margin:20px 10px 0 10px;height:auto">
      <el-form :inline="true" :model="listQuery">
        <el-form-item label="运营中心id:">
          <el-input v-model="listQuery.oc_id" clearable="clearable" maxlength="99999999999"></el-input>
        </el-form-item> 
        <el-form-item label="管理模式：">
            <el-select v-model="listQuery.shop_mode" clearable="clearable" placeholder="请选择">
                <el-option
                  v-for="item in shop_modeQuerySelectData"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="名称:">
          <el-input v-model="listQuery.shop_name" clearable="clearable" maxlength="255"></el-input>
        </el-form-item> 
        <el-form-item>
          <el-dropdown split-button type="primary" @click="onSearch" @command="onSearch" :loading="tabLoading">
            <i class="el-icon-search el-icon--left"></i>{{$t('table.search')}}
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command='all'>查询全部</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-form-item> 
        <el-form-item>
          <el-button type="primary" icon="el-icon-edit" @click="onAdd">{{$t('table.add')}}</el-button>
        </el-form-item> 
      </el-form>
    </el-header>
    <el-main>
      <el-table
        :key="tableKey"
        :data="listData" :height="tableHeight"
        highlight-current-row border fit
        v-loading="tabLoading"
      >
        <el-table-column type="index" label=" " width="50" align="center" :index="table_index" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="shop_id" label="标识id" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="oc_id" label="运营中心id" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="shop_mode" label="管理模式" width="120" align="center" :formatter="commentFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="shop_number" label="店铺号" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="shop_name" label="名称" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="shop_type" label="类型" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="shop_status" label="营业状态" width="120" align="center" :formatter="commentFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="shop_time_type" label="营业时间类型" width="120" align="center" :formatter="commentFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="lng" label="经度" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="lat" label="纬度" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="shop_tel" label="联系电话" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="shop_address" label="店铺地址" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="logo" label="店铺logo" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="auto_get" label="自动接单" width="120" align="center" :formatter="commentFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="delivery_type" label="配送支持(位运算)" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="delivery2" label="自提模式(位运算)" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="reserve" label="接受预定" width="120" align="center" :formatter="commentFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="reserve_max_day" label="预约最大天数" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="reserve_begin_time" label="预定开始时间" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="reserve_end_time" label="预定结束时间" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="imgs" label="门店配图 多图英文逗号分隔" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="notice" label="店铺公告" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="per_cost" label="人均消费" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="send_out_up" label="起送" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="heavy_weather" label="天气情况" width="120" align="center" :formatter="commentFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="delivery_time_usual" label="配送时长" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="delivery_time_special" label="配送时长" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="delivery_cost_usual" label="配送费" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="delivery_cost_special" label="配送费" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="delivery_cost_off" label="配送费减免" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="create_time" label="创建时间" width="120" align="center" :formatter="dateFormat" :show-overflow-tooltip="true"/>
        <el-table-column prop="class_main" label="主营业务分类" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="class_main_value" label="主营业务分类,$分隔" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="class_minor" label="次营业务分类" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="class_minor_value" label="次营业务分类,$分隔" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="parent_id" label="门店关联商户" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="rpt_score" label="店铺评分" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="rpt_month_sale" label="近30天销量" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="rpt_like" label="点赞数" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="rpt_favorite" label="收藏数" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="amount_temp" label="待结算" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="amount" label="余额" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="amount_freeze" label="提现冻结" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="amount_extraction" label="提现汇总" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column prop="rpt_comment" label="评论数" width="120" align="center" :show-overflow-tooltip="true"/>
        <el-table-column
          :label="$t('table.actions')"
          align="left"
          min-width="230"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-dropdown @command="onInfoPages">
              <span class="el-dropdown-link">
                <i class="el-icon-s-tools el-icon--left"></i>功能操作<i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item icon="el-icon-edit" :command="{a:scope,b:'edit'}">{{$t('table.edit')}}</el-dropdown-item> 
                <el-dropdown-item icon="el-icon-search" :command="{a:scope,b:'info'}">{{$t('table.info')}}</el-dropdown-item> 
                <el-dropdown-item icon="el-icon-delete" :command="{a:scope,b:'delete'}">{{$t('table.delete')}}</el-dropdown-item> 
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="pagecnt>1"
        :total="total"
        :page.sync="listQuery.page"
        :limit.sync="listQuery.size"
        @pagination="getList"
      />
    <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
      <el-form ref="dataForm" :model="formData" label-width="200px" style="padding:5% 5% 0 5%">
          <input type="hidden" v-model="formData.shop_id"/>
        <el-form-item label="运营中心id：">
          <el-input v-model="formData.oc_id" placeholder="请输入运营中心id"></el-input>
        </el-form-item>
        <el-form-item label="管理模式：">
            <el-select v-model="formData.shop_mode" placeholder="请选择">
                <el-option
                  v-for="item in shop_modeSelectData"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="店铺号：">
          <el-input v-model="formData.shop_number" placeholder="请输入店铺号"></el-input>
        </el-form-item>
        <el-form-item label="名称：">
          <el-input v-model="formData.shop_name" placeholder="请输入名称"></el-input>
        </el-form-item>
        <el-form-item label="类型：">
          <el-input v-model="formData.shop_type" placeholder="请输入类型"></el-input>
        </el-form-item>
        <el-form-item label="营业状态：">
            <el-select v-model="formData.shop_status" placeholder="请选择">
                <el-option
                  v-for="item in shop_statusSelectData"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="营业时间类型：">
            <el-select v-model="formData.shop_time_type" placeholder="请选择">
                <el-option
                  v-for="item in shop_time_typeSelectData"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="经度：">
          <el-input v-model="formData.lng" placeholder="请输入经度"></el-input>
        </el-form-item>
        <el-form-item label="纬度：">
          <el-input v-model="formData.lat" placeholder="请输入纬度"></el-input>
        </el-form-item>
        <el-form-item label="联系电话：">
          <el-input v-model="formData.shop_tel" placeholder="请输入联系电话"></el-input>
        </el-form-item>
        <el-form-item label="店铺地址：">
          <el-input v-model="formData.shop_address" placeholder="请输入店铺地址"></el-input>
        </el-form-item>
        <el-form-item label="店铺logo：">
          <el-input v-model="formData.logo" placeholder="请输入店铺logo"></el-input>
        </el-form-item>
        <el-form-item label="自动接单：">
            <el-select v-model="formData.auto_get" placeholder="请选择">
                <el-option
                  v-for="item in auto_getSelectData"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="配送支持(位运算)：">
          <el-input-number v-model="formData.delivery_type" :min="0" :max="99999999999" :precision="0"></el-input-number>
        </el-form-item>
        <el-form-item label="自提模式(位运算)：">
          <el-input-number v-model="formData.delivery2" :min="0" :max="99999999999" :precision="0"></el-input-number>
        </el-form-item>
        <el-form-item label="接受预定：">
            <el-select v-model="formData.reserve" placeholder="请选择">
                <el-option
                  v-for="item in reserveSelectData"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="预约最大天数：">
          <el-input v-model="formData.reserve_max_day" placeholder="请输入预约最大天数"></el-input>
        </el-form-item>
        <el-form-item label="预定开始时间：">
          <el-input v-model="formData.reserve_begin_time" placeholder="请输入预定开始时间"></el-input>
        </el-form-item>
        <el-form-item label="预定结束时间：">
          <el-input v-model="formData.reserve_end_time" placeholder="请输入预定结束时间"></el-input>
        </el-form-item>
        <el-form-item label="门店配图 多图英文逗号分隔：">
          <el-input v-model="formData.imgs" placeholder="请输入门店配图 多图英文逗号分隔"></el-input>
        </el-form-item>
        <el-form-item label="店铺公告：">
          <el-input v-model="formData.notice" placeholder="请输入店铺公告"></el-input>
        </el-form-item>
        <el-form-item label="人均消费：">
          <el-input v-model="formData.per_cost" placeholder="请输入人均消费"></el-input>
        </el-form-item>
        <el-form-item label="起送：">
          <el-input v-model="formData.send_out_up" placeholder="请输入起送"></el-input>
        </el-form-item>
        <el-form-item label="天气情况：">
            <el-select v-model="formData.heavy_weather" placeholder="请选择">
                <el-option
                  v-for="item in heavy_weatherSelectData"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="配送时长：">
          <el-input v-model="formData.delivery_time_usual" placeholder="请输入配送时长"></el-input>
        </el-form-item>
        <el-form-item label="配送时长：">
          <el-input v-model="formData.delivery_time_special" placeholder="请输入配送时长"></el-input>
        </el-form-item>
        <el-form-item label="配送费：">
          <el-input v-model="formData.delivery_cost_usual" placeholder="请输入配送费"></el-input>
        </el-form-item>
        <el-form-item label="配送费：">
          <el-input v-model="formData.delivery_cost_special" placeholder="请输入配送费"></el-input>
        </el-form-item>
        <el-form-item label="配送费减免：">
          <el-input v-model="formData.delivery_cost_off" placeholder="请输入配送费减免"></el-input>
        </el-form-item>
        <el-form-item label="创建时间：">
          <el-input v-model="formData.create_time" placeholder="请输入创建时间"></el-input>
        </el-form-item>
        <el-form-item label="主营业务分类：">
          <el-input v-model="formData.class_main" placeholder="请输入主营业务分类"></el-input>
        </el-form-item>
        <el-form-item label="主营业务分类,$分隔：">
          <el-input v-model="formData.class_main_value" placeholder="请输入主营业务分类,$分隔"></el-input>
        </el-form-item>
        <el-form-item label="次营业务分类：">
          <el-input v-model="formData.class_minor" placeholder="请输入次营业务分类"></el-input>
        </el-form-item>
        <el-form-item label="次营业务分类,$分隔：">
          <el-input v-model="formData.class_minor_value" placeholder="请输入次营业务分类,$分隔"></el-input>
        </el-form-item>
        <el-form-item label="门店关联商户：">
          <el-input v-model="formData.parent_id" placeholder="请输入门店关联商户"></el-input>
        </el-form-item>
        <el-form-item label="店铺评分：">
          <el-input v-model="formData.rpt_score" placeholder="请输入店铺评分"></el-input>
        </el-form-item>
        <el-form-item label="近30天销量：">
          <el-input v-model="formData.rpt_month_sale" placeholder="请输入近30天销量"></el-input>
        </el-form-item>
        <el-form-item label="点赞数：">
          <el-input v-model="formData.rpt_like" placeholder="请输入点赞数"></el-input>
        </el-form-item>
        <el-form-item label="收藏数：">
          <el-input v-model="formData.rpt_favorite" placeholder="请输入收藏数"></el-input>
        </el-form-item>
        <el-form-item label="待结算：">
          <el-input v-model="formData.amount_temp" placeholder="请输入待结算"></el-input>
        </el-form-item>
        <el-form-item label="余额：">
          <el-input v-model="formData.amount" placeholder="请输入余额"></el-input>
        </el-form-item>
        <el-form-item label="提现冻结：">
          <el-input v-model="formData.amount_freeze" placeholder="请输入提现冻结"></el-input>
        </el-form-item>
        <el-form-item label="提现汇总：">
          <el-input v-model="formData.amount_extraction" placeholder="请输入提现汇总"></el-input>
        </el-form-item>
        <el-form-item label="评论数：">
          <el-input v-model="formData.rpt_comment" placeholder="请输入评论数"></el-input>
        </el-form-item>
        <el-form-item label="数据版本字段：">
          <el-input v-model="formData.version_id" placeholder="请输入数据版本字段"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
          <el-button
            type="primary"
            v-if="curdAction=='update' || curdAction=='add'"
            @click="onSave"
            :loading="saveLoading" v-text="$t('table.save')"
          ></el-button> 
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import Pagination from "@/components/Pagination";
import { Loading } from "element-ui";
import {
  qr_shopSelecttree,
  qr_shopSelectpage,
  qr_shopSelect,
  qr_shopAdd,
  qr_shopUpdate,
  qr_shopDel,
  qr_shopInfo
} from '@/api/project/wmyw/project_wmyw_qr_shop'
export default {
  name: "a_wmywa_qr_shop",
  components: { Pagination, },
  filters: {},
  data() {
    return {
      dialogTitle: `商户/门店编辑`,
      curdAction: "",
      saveLoading: false,
      delLoading: false,
      tabLoading: false,
      dialogFormVisible: false,
      tableKey: 'wmyw_qr_shop_table',
      listData: null,
      total: 0,
      pagecnt: 0,
      tableHeight: (window.innerHeight-210),
      listQuery: {
        page: 1,
        size: 20,
        oc_id: null, 
        shop_mode: null, 
        shop_name: null, 
      },
      shop_modeQuerySelectData: [
        {value: 1,label: '统一管理'},
        {value: 2,label: '门店自营'},
      ],
      formData: {
        shop_id: null, 
        oc_id: null, 
        shop_mode: null, 
        shop_number: null, 
        shop_name: null, 
        shop_type: null, 
        shop_status: null, 
        shop_time_type: null, 
        lng: null, 
        lat: null, 
        shop_tel: null, 
        shop_address: null, 
        logo: null, 
        auto_get: null, 
        delivery_type: null, 
        delivery2: null, 
        reserve: null, 
        reserve_max_day: null, 
        reserve_begin_time: null, 
        reserve_end_time: null, 
        imgs: null, 
        notice: null, 
        per_cost: null, 
        send_out_up: null, 
        heavy_weather: null, 
        delivery_time_usual: null, 
        delivery_time_special: null, 
        delivery_cost_usual: null, 
        delivery_cost_special: null, 
        delivery_cost_off: null, 
        create_time: null, 
        class_main: null, 
        class_main_value: null, 
        class_minor: null, 
        class_minor_value: null, 
        parent_id: null, 
        rpt_score: null, 
        rpt_month_sale: null, 
        rpt_like: null, 
        rpt_favorite: null, 
        amount_temp: null, 
        amount: null, 
        amount_freeze: null, 
        amount_extraction: null, 
        rpt_comment: null, 
        version_id: null, 
      },
      shop_modeSelectData: [
        {value: 1,label: '统一管理'},
        {value: 2,label: '门店自营'},
      ],
      shop_statusSelectData: [
        {value: 1,label: '营业中'},
        {value: 2,label: '暂停营业'},
      ],
      shop_time_typeSelectData: [
        {value: 1,label: '指定时段'},
        {value: 2,label: '24小时'},
      ],
      auto_getSelectData: [
        {value: 1,label: '关闭'},
        {value: 2,label: '开启'},
      ],
      reserveSelectData: [
        {value: 1,label: '是'},
        {value: 2,label: '否'},
      ],
      heavy_weatherSelectData: [
        {value: 1,label: '正常'},
        {value: 2,label: '恶劣天气'},
      ],
    };
  },
  mounted(){
    let that =this;
    window.onresize=()=>{
      this.tableHeight = (window.innerHeight-210);
    }
  },
  created() {
    this.getList();
  },
  methods: {
    onSearch(command){
      if(command && command=='all'){
        this.resetQuery();
      }
      this.listQuery.page=1;
      this.getList();
    },
    onInfoPage(scope){
      var view = this.$store.state.permission.routesMap["/wmyw/qr_shop_info"];
      this.$router.push({ path: view.path, query: {m_id:view.code_aes,id:scope.row.shop_id} })
    },
    onInfoPages(commend){
      if(commend.b=='edit')this.onEdit(commend.a);
      if(commend.b=='info')this.onInfoPage(commend.a);
      if(commend.b=='delete')this.onDel(commend.a);
    },
    resetQuery(){
      this.listQuery = {
        page: 1,
        size: 20,
        oc_id: null, 
        shop_mode: null, 
        shop_name: null, 
      }
    },
    reset(){
      this.formData = {
        shop_id: null, 
        oc_id: null, 
        shop_mode: null, 
        shop_number: null, 
        shop_name: null, 
        shop_type: null, 
        shop_status: null, 
        shop_time_type: null, 
        lng: null, 
        lat: null, 
        shop_tel: null, 
        shop_address: null, 
        logo: null, 
        auto_get: null, 
        delivery_type: null, 
        delivery2: null, 
        reserve: null, 
        reserve_max_day: null, 
        reserve_begin_time: null, 
        reserve_end_time: null, 
        imgs: null, 
        notice: null, 
        per_cost: null, 
        send_out_up: null, 
        heavy_weather: null, 
        delivery_time_usual: null, 
        delivery_time_special: null, 
        delivery_cost_usual: null, 
        delivery_cost_special: null, 
        delivery_cost_off: null, 
        create_time: null, 
        class_main: null, 
        class_main_value: null, 
        class_minor: null, 
        class_minor_value: null, 
        parent_id: null, 
        rpt_score: null, 
        rpt_month_sale: null, 
        rpt_like: null, 
        rpt_favorite: null, 
        amount_temp: null, 
        amount: null, 
        amount_freeze: null, 
        amount_extraction: null, 
        rpt_comment: null, 
        version_id: null, 
      };
    },
    onAdd(){
      this.dialogFormVisible=true;
      this.curdAction = "add";
      this.dialogTitle=`商户/门店添加`;
      this.reset();
    },
    onEdit(data){
      this.onInfo(data);
      this.dialogFormVisible=true;
      this.curdAction = "update";
      this.dialogTitle=`商户/门店编辑`;
      this.reset();
    },
    onSave(){
      this.$refs["dataForm"].validate(valid => {
        if (valid) {
          this.saveLoading = true;
          if (this.curdAction == "add") {
            qr_shopAdd(this.$qs.stringify(this.formData)).then(r => {
                this.getList();
                this.reset();
                this.curdAction = '';
                this.saveLoading  = false;
                this.dialogFormVisible = false
            }).catch(()=>{
              this.saveLoading=false;
            });
          } else if (this.curdAction == "update") {
            qr_shopUpdate(this.$qs.stringify(this.formData)).then(r => {
                this.getList();
                this.reset();
                this.curdAction = '';
                this.saveLoading  = false;
                this.dialogFormVisible = false
            }).catch(()=>{
              this.saveLoading=false;
            });
          }
        }
      });
    },
    onDel(data){
        var that = this;
        this.$confirm('确定删除?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        }).then(() => {
            qr_shopDel(that.$qs.stringify({id:data.row.shop_id})).then(r=>{
                that.getList();
                that.reset();
                that.curdAction = '';
                that.delLoading  = false;
                that.$notify({
                    message:"删除成功",
                    type: "success"
                });
            }); 
        }).catch(() => {
            this.$notify({
                message: "已取消删除",
                type: "info"
            }); 
        });
    },
    onInfo(data){
        qr_shopInfo({id:data.row.shop_id}).then(r=>{
            this.formData.shop_id=r.dataSingle.shop_id;
            this.formData.oc_id=r.dataSingle.oc_id;
            this.formData.shop_mode=r.dataSingle.shop_mode;
            this.formData.shop_number=r.dataSingle.shop_number;
            this.formData.shop_name=r.dataSingle.shop_name;
            this.formData.shop_type=r.dataSingle.shop_type;
            this.formData.shop_status=r.dataSingle.shop_status;
            this.formData.shop_time_type=r.dataSingle.shop_time_type;
            this.formData.lng=r.dataSingle.lng;
            this.formData.lat=r.dataSingle.lat;
            this.formData.shop_tel=r.dataSingle.shop_tel;
            this.formData.shop_address=r.dataSingle.shop_address;
            this.formData.logo=r.dataSingle.logo;
            this.formData.auto_get=r.dataSingle.auto_get;
            this.formData.delivery_type=r.dataSingle.delivery_type;
            this.formData.delivery2=r.dataSingle.delivery2;
            this.formData.reserve=r.dataSingle.reserve;
            this.formData.reserve_max_day=r.dataSingle.reserve_max_day;
            this.formData.reserve_begin_time=r.dataSingle.reserve_begin_time;
            this.formData.reserve_end_time=r.dataSingle.reserve_end_time;
            this.formData.imgs=r.dataSingle.imgs;
            this.formData.notice=r.dataSingle.notice;
            this.formData.per_cost=r.dataSingle.per_cost;
            this.formData.send_out_up=r.dataSingle.send_out_up;
            this.formData.heavy_weather=r.dataSingle.heavy_weather;
            this.formData.delivery_time_usual=r.dataSingle.delivery_time_usual;
            this.formData.delivery_time_special=r.dataSingle.delivery_time_special;
            this.formData.delivery_cost_usual=r.dataSingle.delivery_cost_usual;
            this.formData.delivery_cost_special=r.dataSingle.delivery_cost_special;
            this.formData.delivery_cost_off=r.dataSingle.delivery_cost_off;
            this.formData.create_time=r.dataSingle.create_time;
            this.formData.class_main=r.dataSingle.class_main;
            this.formData.class_main_value=r.dataSingle.class_main_value;
            this.formData.class_minor=r.dataSingle.class_minor;
            this.formData.class_minor_value=r.dataSingle.class_minor_value;
            this.formData.parent_id=r.dataSingle.parent_id;
            this.formData.rpt_score=r.dataSingle.rpt_score;
            this.formData.rpt_month_sale=r.dataSingle.rpt_month_sale;
            this.formData.rpt_like=r.dataSingle.rpt_like;
            this.formData.rpt_favorite=r.dataSingle.rpt_favorite;
            this.formData.amount_temp=r.dataSingle.amount_temp;
            this.formData.amount=r.dataSingle.amount;
            this.formData.amount_freeze=r.dataSingle.amount_freeze;
            this.formData.amount_extraction=r.dataSingle.amount_extraction;
            this.formData.rpt_comment=r.dataSingle.rpt_comment;
            this.formData.version_id=r.dataSingle.version_id;
        });
    },
    dateFormat(row, column, cellValue, index){
      return this.$moment(cellValue).format("YYYY/MM/DD");
    }, 
    commentFormat(row, column, cellValue, index){
      try {
        var comment = "";
        if(column.property=='shop_mode'){
          comment='管理模式:统一管理=1 门店自营=2';
        }
        if(column.property=='shop_status'){
          comment='营业状态:营业中=1 暂停营业=2';
        }
        if(column.property=='shop_time_type'){
          comment='营业时间类型:指定时段=1 24小时=2';
        }
        if(column.property=='auto_get'){
          comment='自动接单:关闭=1 开启=2';
        }
        if(column.property=='reserve'){
          comment='接受预定:是=1 否=2';
        }
        if(column.property=='heavy_weather'){
          comment='天气情况:正常=1 恶劣天气=2';
        }
        var array = comment.split(':')[1].split(' ');
        var obj = {};
        for(var i=0;i<array.length;i++){
          var split = array[i].split('=');
          obj[split[1]]=split[0];
        }
        if(obj[cellValue]) return obj[cellValue];
        return cellValue;
      } catch (error) {
        return cellValue;
      }
    },
    table_index(index) {
      return (this.listQuery.page - 1) * this.listQuery.size + index + 1;
    },
    getList() {
      this.tabLoading=true;
      qr_shopSelectpage(this.$qs.stringify(this.listQuery,{ indices: false })).then(r=>{
        this.listData = r.dataArray.dataList;
        this.total = r.dataArray.dataCount;
        this.pagecnt = r.dataArray.pageCount;
        this.tabLoading=false;
      }).catch(()=>{
        this.tabLoading=false;
      });
    }
  }
};
</script>